﻿@RenderPage(view)
        
@functions{
    private string view;

    protected override void InitializePage()
    {
    // Get first verb from Url and use as action
    var action = UrlData[0].ToLower(); 
    // Get second verb and use it as id.
    var id = UrlData[1];
    // Example:
    // mysite.com/projects/edit/0
    // UrlData[0] returns "edit"
    // UrlData[1] returns "0"
     
    // Now act on the action verb:   
    switch(action) {      
       case "search":
           
            if(!IsPost){
                Page.Mode=0;
                //Page.SearchCount=0;
                view="/Maintenance/_SearchForm.cshtml";
            }
            break;
        case "edit":
             //get customer details
            Page.Title="Edit Reference Data";
            Page.Mode="1";
            Page.RefType=Request["refType"];
            Page.RefID=Request["refId"];
            Page.RefDesc=Request["refDesc"];
            view = "/Maintenance/_AddForm.cshtml"; 
            break;
        case "new":
             //get customer details
            Page.Mode="2";
            Page.Title="New Reference Data";
            view = "/Maintenance/_AddForm.cshtml"; 
            break;
        case "searchbp":
            view="/Maintenance/_SearchBP.cshtml";
            break;
        case "editbp":
            //get the Bank Profile
            var bp = BankPartnerManager.GetBP(Convert.ToInt32(id));
            Page.Mode="1";
            Page.BankPartner = bp;
            view="/Maintenance/BPProfile.cshtml";
            break;
        case "editcourier":
            var courier = CourierManager.GetCourier(Convert.ToInt32(id));
            Page.Mode="1";
            Page.Courier = courier;
            view="/Maintenance/CourierProfile.cshtml";
            break;
     
        case "courier_search":
            view="/Maintenance/_SearchCourier.cshtml";
            break;
        default:
            view = "/Maintenance/_Menu.cshtml";       
            break;
        }
    }
 }         

     